﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/view.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Workflow.Resource" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">

        function actionFormatter(value, rowData, rowIndex) {

            var id = rowData.Id;
            var a = "  <img title=\"<%=Global.Edit %>\" alt=\"<%=Global.Edit %>\" src=\"../../Image/edit.gif\" onclick=\"UpdateHoliday('" + id + " ')\" />"

            var p = " <img title=\"<%=Global.Delete %>\" alt=\"<%=Global.Delete %>\" src=\"../../Image/deactivate.gif\" onclick=\"DeleteHoliday('" + id + " ')\" />";

           
          //  return a+'&nbsp;' + p ;
            return  p;
        }
        function addHoliday() {
            window.location = '/Holiday/Detail';
            return false;
        }
        function UpdateHoliday(id) {
            window.location = '/Holiday/Detail/' + id;
            return false;
        }
        function Upload() {
            window.location = '/Holiday/Upload/';
            return false;
        }
        
        function DeleteHoliday(id) {

            $.messager.confirm('<%=Global.InfoTitle%>', '<%=Global.confimDelete%>', function (r) {
                if (r) {
                    //alert(user_form);
                    $('#form').form('submit', {
                        url: '/Holiday/DeleteHoliday/' + id,
                        success: function (data) {
                            eval('data=' + data);
                            if (data.Success) {
                                // _user_form.form('clear');
                                $.messager.alert('<%=Global.InfoTitle%>', data.Message, 'info');
                            } else {
                                $.messager.alert('<%=Global.ErrorTitle%>', data.Message, 'error');
                            }
                            $("#grid").datagrid('reload');
                        },
                        onSubmit: function () {
                            //if (_user_form.valid())
                            return true;
                            // else
                            //    return false;
                        }
                    });
                }
            });

        }

       
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <form class="easyui-layout" method="post" id="form" name="form" style=" width:100%;height: 700px;">
       <div region="center" >
    <table id="grid" class="easyui-datagrid"   url="/Holiday/GetHoliday"
        title="<%=Global.Holiday%>" toolbar="#tb" fit="true" singleselect="true" fitcolumns="true" pagination="true"
        queryparams="{}">
        <thead>
            <tr>
                <th field="IdleDate" width="160">
                 <%=Global.IdleDate%>
                    
                </th>
                <th field="action" width="200" align="center" formatter="actionFormatter">
                      <%=Global.Action%>
                </th>
            </tr>
        </thead>
    </table>
    <div id="tb" style="padding: 5px; height: auto">
        <div style="margin-bottom: 5px">
            <a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="addHoliday();">
                 <%=Global.addHoliday%></a>
                 <a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="Upload();">
                 <%=Global.UploadHoliday%></a>
        </div>
        
    </div>
    </div>
    </form>
</asp:Content>
